<template>
	<view>
		<view style="width: 100%; margin: 0 auto;background-color: #FFFFFF;">
			<view style="width: 90%; height: 760px; margin: 0 auto;background-color: #FFFFFF;">
				<view style="overflow: hidden;">
					<view style="font-size: 28px;float: left;">{{campus.campusName}}</view>
<!-- 					<view @click="uniShare()">
						<u-icon name="share-square" size="30" style="float: right;margin-top: 2px;"></u-icon>
					</view> -->
					<u-tag text="详情" plain size="mini" type="warning"
						style="width: 80rpx;margin-top: 5px;float: right;"></u-tag>
				</view>

				<view style="margin-top: 5rpx;">
					<image :src="campus.campusImgs"></image>
				</view>
				<view style="text-indent:24px;margin-top: 10rpx;font-size: 20px;color: #555555;line-height: 25px;">
					<text>{{campus.campusAbout}}</text>
				</view>


			</view>
		</view>
	</view>
</template>

<script>

	export default {
		// onBackPress({from}) {
		// 	console.log(from);
		// 	if(from=='backbutton'){
		// 		this.$nextTick(function(){
		// 			uniShare1.hide()
		// 		})
		// 		return uniShare1.isShow;
		// 	}
		// },
		components: {},
		data() {
			return {
				id: 0,
				liste: "",
				eid: "",
				checked: false,
				showUpImg: true,
				jourid: '',
				health: 
					
					{
						"jourid": 2,
						"theme": "小红离职了2",
						"jrname": "小红1",
						"jimage": "https://guli-xueyuan01.oss-cn-beijing.aliyuncs.com/oa/news/02.jpg",
						"content": "2022年5月9日下午，东呈集团加盟服务中心在抖音平台联动蔡老师、R先生、丹哥、朗子等酒店运营大咖、行业资深投资人发起了一场关于\"酒店低效空间 高效利用\"的直播讨论活动，共同探讨疫情当下酒店行业如何纾困及创新创收",
						"jtime": 1652272901000,
						"lismtype": "0",
						"num": 4
					},
					campus:{}
					
				
			}
		},
		onLoad(res) {
			console.log(res)
			this.id = res.id;
			console.log("id:::"+this.id)
			this.findxwID();
		},
			
		methods: {
			aa(date){
							const dateTime = new Date(date)
							const YY = dateTime.getFullYear()
							const MM =
								dateTime.getMonth() + 1 < 10 ? '0' + (dateTime.getMonth() + 1) : dateTime.getMonth() + 1
							const DD =
								dateTime.getDate() < 10 ? '0' + dateTime.getDate() : dateTime.getDate()
							const hh =
								dateTime.getHours() < 10 ? '0' + dateTime.getHours() : dateTime.getHours()
							const mm =
								dateTime.getMinutes() < 10 ? '0' + dateTime.getMinutes() : dateTime.getMinutes()
							const ss =
								dateTime.getSeconds() < 10 ? '0' + dateTime.getSeconds() : dateTime.getSeconds()
							return `${YY}-${MM}-${DD}`
						},
			// 分享
			uniShare(){
				let that = this
					let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
					let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由，也就是最后一个打开的页面路由
				uni.share({
						provider: "weixin",
						scene: "WXSceneSession",
						type: 0,
						href:'/index/hjj/xinwen/XinwenInfo',
						title: that.health.theme,
						summary: that.health.content,
						// "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/d8590190-4f28-11eb-b680-7980c8a877b8.png
						imageUrl: "static/lx1.jpg",
						success: function (res) {
							console.log("success:" + JSON.stringify(res));
						},
						fail: function (err) {
							console.log("fail:" + JSON.stringify(err));
						}
				})
			},
			// 收藏
			onClick() {
				var that = this
				this.checked = !this.checked
				if (!this.checked) {
					request({
						url: 'fragmentary/deleteXwSc?jourid='+this.jourid,
						method: 'POST',
						success: (res) => {
							uni.showToast({
								title: "取消收藏"
							})
						}
					})
				} else {
					uni.getStorage({
						key: "user",
						success: function(res) {
							that.liste = res.data
						},
					});
					request({
						url: 'fragmentary/addXwSc',
						data: {
							eid: this.liste.eid,
							jourid: this.jourid
						},
						method: 'POST',
						dataType: 'json',
						success: (res) => {
							console.log("看一下userid", that.liste.eid);
							uni.showToast({
								title: "收藏成功"
							})
						}
					})


				}
			},

			findxwID() {
				uni.request({
					url: "http://localhost:9000/user/user/campus/findByCampusID/" + this.id,
					method: 'get',
					success: (res) => {
						console.log(res)
						this.campus = res.data.data.campus
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #fff;
	}
	.example-body {
		display: flex;
		padding: 10px 15px;
	}

	/* #ifdef MP-ALIPAY */
	.uni-fav {
		margin-left: 20rpx;
	}

	/* #endif */


	.favBtn {
		margin: 0 20rpx 20rpx 0;
	}


	.example-body-fullWidth {
		padding: 32rpx 0;
	}

	.example-body-first {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: flex-start;
	}

	.favBtn-nav {
		// left:-50rpx;
	}
</style>
